package jam.UserInterface.UI;
import javax.swing.*;
import javax.swing.border.Border;
import java.io.File;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.event.*;

public class helpWindow extends JFrame implements ActionListener {

	private JFrame help = new JFrame();
	private JTextArea display = new JTextArea();
	private JScrollPane pane;
	private JButton close = new JButton();
	
	public helpWindow(){
		//optional look and feel
		UIManager.LookAndFeelInfo[] lfi= UIManager.getInstalledLookAndFeels();
		    
		try
		{
		UIManager.setLookAndFeel(lfi[1].getClassName());
		}
		catch (Exception e)
		{
		System.out.println("Can't set chosen look-and-feel!");
	    }

		help.setDefaultLookAndFeelDecorated(true);
		
		Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
		help.setBounds(((int)(screenSize.getWidth()-400))/2,((int)(screenSize.getHeight()-400))/2,400,400);
		help.setTitle("Help");
		help.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
		help.setLayout(new FlowLayout());
		
		//change the icon code
		String currentDirectory = System.getProperty("user.dir");
		try {
			Image image = ImageIO.read(new File(currentDirectory + "/src/jam/UserInterface/Icons/JAMicon.png"));
			help.setIconImage(image);
		}catch (Exception e){System.out.println("The file could not be read!!!!");}
		
		display.setPreferredSize(new Dimension(300,300));
		display.setMinimumSize(new Dimension(300,300));
		display.setLineWrap(true);
		display.setEditable(false);
		pane = new JScrollPane(display);
		pane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
		
		display.append("Fresh Prince Of Bel-Air (Theme Song) lyrics \n" +
				"Now this is a story all about how \n" +
				"My life got flipped-turned upside down \n" +
				"And I liked to take a minute just sit right there \n" +
				"And tell you how I became the prince of a town called Bel-Air \n" +
				"\n" +
				"[verse 2] \n" +
				"In west Philadelphia born and raised \n" +
				"On the playground is where I spent most of my days \n" +
				"Chillin out, maxin, relaxing all cool, \n" +
				"And all shooting some b-ball outside of the school \n" +
				"When a couple of guys who were up to no good \n" +
				"Started making trouble in my neighborhood \n" +
				"I got in one lil fight and my mom got scared \n" +
				"And said 'You're moving with your auntie and uncle in Bel-Air' \n" +
				"I Begged and pleaded with her day after day, \n" +
				"But she packed my suitcase and sent me on my way \n" + 
				"She gave me a kiss and then she gave me my ticket \n" +
				"I put my walkman on and said I might as well kick it \n" +
				"[verse 3] \n" +
				"First class yo this is bad \n" +
				"Drinking orange juice out of a champaine glass \n" +
				"Is this what the people of Bel-Air living like? \n" +
				"Hmm this might be allright \n" +
				"But wait I hear prissy, bourgeois and all that \n" +
				"Is this the type of place they should send this cool cat \n" +
				"I don't think so, I'll see when I get there \n" +
				"I hope they're prepared for the prince of Bel-Air \n" +
				"\n" +
				"[verse 4] \n" +
				"Well ah the plain landed and when I came out \n" +
				"There was a dude that looked like a cop standing there with my name out \n" +
				"I aint trying to get arrested yet I just got here \n" +
				"I sprang with the quickness like lightning dissapeared \n" +
				"I whistled for a cab and when it came near \n" +
				"The license plate said FRESH and it had dice in the mirror \n" +
				"If anything I can say this cab was rare \n" +
				"But I thought naw forget it yo homes to Bel-Air \n" +
				" \n" +
				"[verse 5] \n" +
				"I pulled up to the house about 7 or 8 \n" +
				"And I yelled to the cabby 'Yo homes smell ya later' \n" +
				"I looked at my kingdom I was finally there \n" +
				"To sit on my throne as the Prince of Bel Air \n");

		help.add(pane);
		
		//some spacing
		
		JLabel spacing = new JLabel();
		spacing.setText("              ");
		help.add(spacing);
		
		close.setText("Close");
		close.addActionListener(this);
		close.setMinimumSize(new Dimension(30,20));
		close.setMaximumSize(new Dimension(30,20));
		help.add(close);
		
		help.setVisible(true);
		
	}
	@Override
	public void actionPerformed(ActionEvent e) {
		if (e.getSource() == close){
			help.dispose();
		}
		
	}

}
